package org.csu.jpetmanage.controller;

import org.csu.jpetmanage.util.UploadUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
@Controller
public class UploadController {
    @GetMapping("/upload")
    public String upload()
    {
        return "upload";
    }
    @PostMapping("/upImg")
    @ResponseBody
    public String upImag(MultipartFile file) throws IOException {
       return UploadUtil.uploadImage(file);
    }
}
